/**
 *
 */
package uk.co.hs.dao.web.admin;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import uk.co.hs.dao.generic.UtilisoftGenericDao;
import uk.co.hs.domain.web.WebForwarding;

/**
 * WebForwardingDao.
 */
@Repository("hs_webForwardingDao")
public class WebForwardingDao extends UtilisoftGenericDao<WebForwarding, Long>
{
  public WebForwarding getWebForwarding(final String aUsername)
  {
    Query query = getSession().createQuery("FROM WebForwarding forwarding WHERE forwarding.webUser.username = :username AND forwarding.webUser.endDate IS NULL");
    query.setParameter("username", aUsername);
    return (WebForwarding) query.uniqueResult();
  }
}
